{extend name="base"}
{block name="title"}后台人员管理{/block}
{block name="head"}
<style>
td.sfjy_0{color:#19be6b}
td.sfjy_1{color:#ed4014}
</style>
{/block}
{block name="body"}
<body class="mainbody">
<form>
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>后台人员管理</span>
</div>
<!--/导航栏-->

<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <div class="menu-list">
          <div class="rule-single-select">
            <select name="RoleID" style="display:none">
              <option value="-1">===所有角色===</option>
              {volist name="ADMIN_ROLES" id='val'}
              <option value="{$key}"{eq name="RoleID" value="$key"} selected{/eq}>[{$key}]{$val}</option>
              {/volist}
            </select>
          </div>
          <div class="rule-single-select">
            <select name="IsDisabled" style="display:none">
              <option value="-1">===禁用状态===</option>
              {volist name="STATES" id='val'}
              <option value="{$key}"{eq name="IsDisabled" value="$key"} selected{/eq}>[{$key}]{$val}</option>
              {/volist}
            </select>
          </div>
          <input type="button" value="添加账号" id="btnAdd" />
        </div>
      </div>
    </div>
  </div>
</div>

<div class="table-container">
  <table class="ltable border-table">
    <thead>
      <tr>
        <th>ID</th>
        <th>角色</th>
        <th>登陆账号</th>
        <th>昵称</th>
        <th>邮箱</th>
        <th>手机号码</th>
        <th>登陆次数</th>
        <th>是否禁用</th>
        <th>最后登录IP</th>
        <th>最后登录时间</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
{empty name="list"}
      <tr><td colspan="11">Oh~暂无数据!</td></tr>
{else/}
    {volist name="list" id="v"}
      <tr data-id="{$v.AdminId}">
        <td>{$v.AdminId}</td>
        <td><a target="_blank" href="{:url('system.rbac.node/index')}?RoleID={$v.RoleID}">[{$v.RoleID}]{$ADMIN_ROLES[$v.RoleID] ?? '--'}</a></td>
        <td>{$v.UserName}</td>
        <td>{$v.NickName}</td>
        <td>{$v.Email}</td>
        <td>{$v.Mobile}</td>
        <td>{$v.LoginNum}</td>
        <td class="sfjy_{$v.IsDisabled}">[{$v.IsDisabled}]{$STATES[$v.IsDisabled] ?? '--'}</td>
        <td>{$v.LastLoginIP}</td>
        <td>{$v.LastLoginTime}</td>
        <td><input type="button" value="修改" class="a" /></td>
      </tr>
    {/volist}
{/empty}
    </tbody>
  </table>
</div>

<div class="page-footer"><div class="btn-wrap">{$list->render()}</div></div>

</form>
<script>
$(function () {
  $.AdminControl.init({
    URL_DETAIL: "{:url('system.rbac.user/detail')}",
    URL_DELETE: "{:url('system.rbac.user/delete')}"
  });
  $('#btnAdd').click(function(){ // 添加账号
    $.AdminControl.ShowDetailDialog(0);
  });
  $('input.a').click(function () {  // 修改账号
    var tr = $(this).parents('tr');
    var AdminID = tr.data('id');
    $.AdminControl.ShowDetailDialog(AdminID);
  });
});
</script>
</body>
{/block}